using System;

namespace TrueCode.DependencyManager.Interface
{
  [AttributeUsage( AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor,
    AllowMultiple = false, Inherited = true )]
  public class InjectHereAttribute : Attribute, IComparable
  {
    private readonly int _callOrder;

    public InjectHereAttribute() : this( 0 )
    {
    }

    public InjectHereAttribute( int callOrder )
    {
      _callOrder = callOrder;
    }

    #region Implementation of IComparable
    public int CompareTo( object obj )
    {
      var other = obj as InjectHereAttribute;
      return other == null ? -1 : _callOrder.CompareTo( other._callOrder );
    }
    #endregion
  }
}